
using System;
using System.Collections;

namespace Moonlite.Languages.Andromeda {



internal class Parser {
	public const int _EOF = 0;
	public const int _ident = 1;
	public const int _intLit = 2;
	public const int _floatLit = 3;
	public const int _charLit = 4;
	public const int _stringLit = 5;
	public const int _abilcmd = 6;
	public const int _actor = 7;
	public const int _actorscope = 8;
	public const int _aifilter = 9;
	public const int _bank = 10;
	public const int _bool = 11;
	public const int _byte = 12;
	public const int _camerainfo = 13;
	public const int _color = 14;
	public const int _doodad = 15;
	public const int _fixed = 16;
	public const int _int = 17;
	public const int _marker = 18;
	public const int _order = 19;
	public const int _playergroup = 20;
	public const int _point = 21;
	public const int _revealer = 22;
	public const int _sound = 23;
	public const int _soundlink = 24;
	public const int _string = 25;
	public const int _text = 26;
	public const int _timer = 27;
	public const int _transmissionsource = 28;
	public const int _trigger = 29;
	public const int _unit = 30;
	public const int _unitfilter = 31;
	public const int _unitgroup = 32;
	public const int _unitref = 33;
	public const int _void = 34;
	public const int _wave = 35;
	public const int _waveinfo = 36;
	public const int _wavetarget = 37;
	public const int _class = 38;
	public const int _enrich = 39;
	public const int _false = 40;
	public const int _final = 41;
	public const int _new = 42;
	public const int _null = 43;
	public const int _static = 44;
	public const int _const = 45;
	public const int _super = 46;
	public const int _this = 47;
	public const int _true = 48;
	public const int _colon = 49;
	public const int _comma = 50;
	public const int _dec = 51;
	public const int _dot = 52;
	public const int _assign = 53;
	public const int _inc = 54;
	public const int _lbrace = 55;
	public const int _lbrack = 56;
	public const int _lpar = 57;
	public const int _minus = 58;
	public const int _not = 59;
	public const int _plus = 60;
	public const int _rbrace = 61;
	public const int _rbrack = 62;
	public const int _rpar = 63;
	public const int _tilde = 64;
	public const int maxT = 133;

	const bool T = true;
	const bool x = false;
	const int minErrDist = 2;
	
	public Scanner scanner;
	public Errors  errors;

	public Token t;    // last recognized token
	public Token la;   // lookahead token
	int errDist = minErrDist;

internal class Modifier
{
	public static readonly int Public       = 0x0001;
	public static readonly int Private      = 0x0002;
	public static readonly int Protected    = 0x0004;
	public static readonly int Static       = 0x0008;
	public static readonly int Final        = 0x0010;
	public static readonly int Volatile     = 0x0040;
	public static readonly int Transient    = 0x0080;
	public static readonly int Native       = 0x0100;
	public static readonly int Internal     = 0x0200;
	public static readonly int Abstract     = 0x0400;
	public static readonly int Const        = 0x0800;
	public static readonly int
		None         = 0x0000,
		Access       = Public | Protected | Private | Internal,
		Classes      = Access | Abstract | Static | Final,
		Fields       = Access | Static | Final | Transient | Volatile | Const,
		Methods      = Access | Abstract | Static | Final | Native,
		Properties   = Access | Abstract | Static,
		Accessors    = Access,
		Constructors = Access,
		Interfaces   = Access | Abstract | Static,
		Constants    = Public | Static | Final | Const,
		All          = 0x0dff;
}
 
internal class Modifiers
{
	private long cur = 0L;
	private Parser parser;
	
	public Modifiers(Parser parser)
	{
		this.parser = parser;
	}

	public bool contains(long m)
	{
		return ((cur & m) != 0);
	}

	public void add(long m)
	{
		if ((cur & m) == 0)
		{
			cur |= m;
		}
		else
		{
			parser.error("Repeated modifier.");
		}
	}
	
	public void check(long allowed)
	{
		long wrong = cur & (allowed ^ Modifier.All);
		if (wrong != Modifier.None)
		{
			parser.error("Modifier(s) " + toString(wrong) + "not allowed in this context.");
		}
		else
		{
			checkAccess();
		}
	}
	
	private void checkAccess()
	{
		long Access = cur & Modifier.Access;
		if (Access != Modifier.None && Access != Modifier.Public &&  Access != Modifier.Protected && Access != Modifier.Private)
		{
			parser.error("Illegal combination of modifiers: " + toString(Access) + ".");
		}
	}
	
	private string toString(long m)
	{
	    string s = "";
	    if ((m & Modifier.Public) != 0) s += "public ";
	    if ((m & Modifier.Private) != 0) s += "private ";
	    if ((m & Modifier.Protected) != 0) s += "protected ";
	    if ((m & Modifier.Static) != 0) s += "static ";
	    if ((m & Modifier.Final) != 0) s += "final ";
	    if ((m & Modifier.Volatile) != 0) s += "volatile ";
	    if ((m & Modifier.Transient) != 0) s += "transient ";
	    if ((m & Modifier.Native) != 0) s += "native ";
	    if ((m & Modifier.Abstract) != 0) s += "abstract ";
	    return s;
	}
}

internal static class ExprKind
{
	public static readonly int NONE      =  0;
	public static readonly int CONDEXPR  = 17;
	public static readonly int APPLY     = 25;
	public static readonly int NEWCLASS  = 26;
	public static readonly int NEWARRAY  = 27;
	public static readonly int PARENS    = 28;
	public static readonly int ASSIGN    = 29;
	public static readonly int TYPECAST  = 30;
	public static readonly int TYPETEST  = 31;
	public static readonly int SELECT    = 33;
	public static readonly int IDENT     = 34;
	public static readonly int LITERAL   = 35;
	public static readonly int POS       = 41;
	public static readonly int NEG       = 42;
	public static readonly int NOT       = 43;
	public static readonly int COMPL     = 44;
	public static readonly int PREINC    = 45;
	public static readonly int PREDEC    = 46;
	public static readonly int POSTINC   = 47;
	public static readonly int POSTDEC   = 48;
	public static readonly int BINARY    = 50;
	public static readonly int KEYOF     = 51;
}

internal class ExprInfo
{
	private int kind = ExprKind.NONE;
	private Parser parser;
	public void setKind(int kind)
	{
		this.kind = kind;
	}
	
	public int getKind()
	{
		return kind;
	}
	
	public ExprInfo(Parser parser)
	{
		this.parser = parser;
	}
	
	public void checkExprStat()
	{
		if (kind != ExprKind.APPLY &&  kind != ExprKind.NEWCLASS && 
			kind != ExprKind.ASSIGN && kind != ExprKind.PREINC &&
			kind != ExprKind.PREDEC && kind != ExprKind.POSTINC &&
			kind != ExprKind.POSTDEC && kind != ExprKind.IDENT)
		{
		  	parser.error("not a statement" + " (" + kind + ")");
		}
	}
}

private static readonly int MaxTerminals = 160;
private static int[] typeKWarr = new int[] { _abilcmd, _actor, _actorscope, _aifilter, _bank, _bool, _byte, _byte, _camerainfo, _color, _doodad, _fixed, _int, _marker, _order, _playergroup, _point, _revealer, _sound, _soundlink, _string, _text, _timer, _transmissionsource, _trigger, _unit, _unitfilter, _unitgroup, _unitref, _void, _wave, _waveinfo, _wavetarget };
private static int[] castFollowerArr = new int[] { _ident, _new, _super, _this, _void, _intLit, _floatLit, _charLit, _stringLit, _true, _false, _null, _lpar, _not, _tilde };
private static int[] prefixArr = new int[] { _inc, _dec, _not, _tilde, _plus, _minus };    
private static BitSet
	typeKW       = NewSet(typeKWarr),
	castFollower = Or(NewSet(castFollowerArr), typeKW),
	prefix       = NewSet(prefixArr);

private static BitSet NewSet(int[] values)
{
	BitSet s = new BitSet(MaxTerminals);
	for (int i = 0; i < values.Length; i++)
	{
		s.Set(values[i]);
	}
	
	return s;
}

private static BitSet Or(BitSet s1, BitSet s2)
{
	s1.Or(s2);
	return s1;
}                            

private void error(string s)
{
	if (errDist >= minErrDist)
	{
		errors.SemErr(la.line, la.col, s);
	}
	
	errDist = 0;
}

// "(" BasicType {"[""]"} ")"
bool isSimpleTypeCast () {
  // assert: la.kind == _lpar
  scanner.ResetPeek();
  Token pt1 = scanner.Peek();
  
  if (typeKW.Get(pt1.kind)) {
    Token pt = scanner.Peek();
    pt = skipDims(pt);
    if (pt != null) {
      return pt.kind == _rpar;
    }
  }
  return false;
}

// "(" Qualident {"[" "]"} ")" castFollower
bool guessTypeCast () {
  // assert: la.kind == _lpar
  scanner.ResetPeek();
  Token pt = scanner.Peek();
  pt = rdQualident(pt);
  if (pt != null) {
    pt = skipDims(pt);
    if (pt != null) {
      Token pt1 = scanner.Peek();
      return pt.kind == _rpar && castFollower.Get(pt1.kind);
    }
  }
  return false;
}

// "[" "]"
Token skipDims (Token pt) {
  if (pt.kind != _lbrack) return pt;
  do {
     pt = scanner.Peek();
    if (pt.kind != _rbrack) return null;
     pt = scanner.Peek();
  } while (pt.kind == _lbrack);  
  return pt;
}

/* Checks whether the next sequence of tokens is a qualident *
 * and returns the qualident string                          *
 * !!! Proceeds from current peek position !!!               */
Token rdQualident (Token pt) {
  string qualident = "";
  
  if (pt.kind == _ident) {
    qualident = pt.val;
    pt = scanner.Peek();
    while (pt.kind == _dot) {
      pt = scanner.Peek();
      if (pt.kind != _ident) return null;
      qualident += "." + pt.val;
      pt = scanner.Peek();
    }
    return pt;
  } else return null;
}

// Return the n-th token after the current lookahead token
Token peek(int n) {
  scanner.ResetPeek();
  Token x = la;
  while (n > 0) { x = scanner.Peek(); n--; }
  return x;
}

/*-----------------------------------------------------------------*
 * Resolver routines to resolve LL(1) conflicts:                   *
 * These routines return a bool value that indicates            *
 * whether the alternative at hand shall be choosen or not.        *
 * They are used in IF ( ... ) expressions.                        *       
 *-----------------------------------------------------------------*/

// ',' (no '}')
bool commaAndNoRBrace() {
  return (la.kind == _comma && peek(1).kind != _rbrace);
}

// '.' ident
bool dotAndIdent() {
  return la.kind == _dot && peek(1).kind == _ident;
}

// ident '('
bool identAndLPar () {
  return la.kind == _ident && peek(1).kind == _lpar;
}

// '[' (no ']')
bool nonEmptyBracket() {
  return (la.kind == _lbrack && peek(1).kind != _rbrack);
}

// '['']'
bool emptyBracket() {
  return (la.kind == _lbrack && peek(1).kind == _rbrack);
}

// final or Type ident
bool isLocalVarDecl(bool finalIsSuccess) {
  Token pt = la;
  scanner.ResetPeek();
  
  if (la.kind == Modifier.Final) 
    if (finalIsSuccess) return true;
    else pt = scanner.Peek();

  // basicType | ident
  if (typeKW.Get(pt.kind))
    pt = scanner.Peek();
  else
    pt = rdQualident(pt);
    
  if (pt != null) {
    pt = skipDims(pt);
    if (pt != null) {
      return pt.kind == _ident;
    }
  }
  return false;
}

bool isTypeCast() {
  if (la.kind != _lpar) return false;
  if (isSimpleTypeCast()) return true;
  return guessTypeCast();
}

// '.' ("super" '.' | "class" | "this") | '(' | '['']'
bool isIdentSuffix() {
  if (la.kind == _dot) {
    scanner.ResetPeek();
    Token pt = scanner.Peek();
    if (pt.kind == _super) return scanner.Peek().kind == _dot;
    return (pt.kind == _class || pt.kind == _this || pt.kind == _enrich);
  }
  return (la.kind == _lpar || emptyBracket());
}

/*-------------------------------------------------------------------------*/



	public Parser(Scanner scanner) {
		this.scanner = scanner;
		errors = new Errors();
	}

	void SynErr (int n) {
		if (errDist >= minErrDist) errors.SynErr(la.line, la.col, n);
		errDist = 0;
	}

	public void SemErr (string msg) {
		if (errDist >= minErrDist) errors.SemErr(t.line, t.col, msg);
		errDist = 0;
	}
	
	void Get () {
		for (;;) {
			t = la;
			la = scanner.Scan();
			if (la.kind <= maxT) { ++errDist; break; }

			la = t;
		}
	}
	
	void Expect (int n) {
		if (la.kind==n) Get(); else { SynErr(n); }
	}
	
	bool StartOf (int s) {
		return set[s, la.kind];
	}
	
	void ExpectWeak (int n, int follow) {
		if (la.kind == n) Get();
		else {
			SynErr(n);
			while (!StartOf(follow)) Get();
		}
	}


	bool WeakSeparator(int n, int syFol, int repFol) {
		int kind = la.kind;
		if (kind == n) {Get(); return true;}
		else if (StartOf(repFol)) {return false;}
		else {
			SynErr(n);
			while (!(set[syFol, kind] || set[repFol, kind] || set[0, kind])) {
				Get();
				kind = la.kind;
			}
			return StartOf(syFol);
		}
	}

	
	void Andromeda() {
		if (la.kind == 65) {
			Get();
			Qualident();
			Expect(66);
		}
		while (la.kind == 67) {
			ImportDeclaration();
		}
		while (StartOf(1)) {
			TypeDeclaration();
		}
		if (la.kind != _EOF) error("'class', 'enrich', 'typedef', 'interface' or member declaration expected"); 
	}

	void Qualident() {
		Expect(1);
		while (la.kind == 52) {
			Get();
			Expect(1);
		}
	}

	void ImportDeclaration() {
		Expect(67);
		Expect(1);
		QualifiedImport();
		Expect(66);
	}

	void TypeDeclaration() {
		if (StartOf(2)) {
			ClassOrInterfaceDeclaration();
		} else if (la.kind == 66) {
			Get();
		} else SynErr(134);
	}

	void QualifiedImport() {
		Expect(52);
		if (la.kind == 1) {
			Get();
			if (la.kind == 52) {
				QualifiedImport();
			}
		} else if (la.kind == 68) {
			Get();
		} else SynErr(135);
	}

	void ClassOrInterfaceDeclaration() {
		Modifiers m = new Modifiers(this); 
		if (la.kind == 78) {
			TypedefDeclaration(m);
		} else if (StartOf(3)) {
			while (StartOf(4)) {
				ClassModifier(m);
			}
			if (la.kind == 38) {
				ClassDeclaration(m);
			} else if (la.kind == 87) {
				InterfaceDeclaration(m);
			} else if (la.kind == 39) {
				EnrichDeclaration(m);
			} else if (StartOf(5)) {
				StaticBlockDeclaration();
			} else SynErr(136);
		} else if (StartOf(6)) {
			MemberDecl(m);
		} else if (StartOf(5)) {
			StaticBlockDeclaration();
		} else SynErr(137);
	}

	void StaticBlockDeclaration() {
		Modifiers m = new Modifiers(this); 
		if (la.kind == 44) {
			Get();
			m.add(Modifier.Static);            
		}
		if (la.kind == 55) {
			Block();
		} else if (StartOf(7)) {
			if (StartOf(8)) {
				Modifier1(m);
				while (StartOf(9)) {
					Modifier0(m);
				}
			}
			MemberDecl(m);
		} else SynErr(138);
	}

	void Block() {
		Expect(55);
		while (StartOf(10)) {
			BlockStatement();
		}
		Expect(61);
	}

	void Modifier1(Modifiers m) {
		switch (la.kind) {
		case 69: {
			Get();
			m.add(Modifier.Public);      
			break;
		}
		case 70: {
			Get();
			m.add(Modifier.Protected);   
			break;
		}
		case 71: {
			Get();
			m.add(Modifier.Private);     
			break;
		}
		case 72: {
			Get();
			m.add(Modifier.Internal);    
			break;
		}
		case 73: {
			Get();
			m.add(Modifier.Abstract);    
			break;
		}
		case 41: {
			Get();
			m.add(Modifier.Final);       
			break;
		}
		case 74: {
			Get();
			m.add(Modifier.Native);      
			break;
		}
		case 75: {
			Get();
			m.add(Modifier.Transient);   
			break;
		}
		case 76: {
			Get();
			m.add(Modifier.Volatile);    
			break;
		}
		default: SynErr(139); break;
		}
	}

	void Modifier0(Modifiers m) {
		if (la.kind == 44) {
			Get();
			m.add(Modifier.Static);    
		} else if (la.kind == 45) {
			Get();
			m.add(Modifier.Const);     
		} else if (StartOf(8)) {
			Modifier1(m);
		} else SynErr(140);
	}

	void MemberDecl(Modifiers m) {
		if (identAndLPar()) {
			Expect(1);
			ConstructorDeclaratorRest(m);
		} else if (StartOf(11)) {
			MethodOrFieldDecl(m);
		} else if (la.kind == 34) {
			m.check(Modifier.Methods); 
			Get();
			Expect(1);
			VoidMethodDeclaratorRest();
		} else if (la.kind == 38) {
			ClassDeclaration(m);
		} else if (la.kind == 87) {
			InterfaceDeclaration(m);
		} else SynErr(141);
	}

	void TypedefDeclaration(Modifiers m) {
		Expect(78);
		if (la.kind == 1) {
			Get();
		} else if (StartOf(11)) {
			Type();
		} else SynErr(142);
		if (la.kind == 79) {
			Get();
		}
		if (la.kind == 80 || la.kind == 81 || la.kind == 82) {
			if (la.kind == 80) {
				Get();
			} else if (la.kind == 81) {
				Get();
			} else {
				Get();
			}
			if (la.kind == 1) {
				Get();
			} else if (StartOf(11)) {
				Type();
			} else SynErr(143);
		}
		Expect(66);
	}

	void ClassModifier(Modifiers m) {
		switch (la.kind) {
		case 69: {
			Get();
			m.add(Modifier.Public);    
			break;
		}
		case 70: {
			Get();
			m.add(Modifier.Protected); 
			break;
		}
		case 71: {
			Get();
			m.add(Modifier.Private);   
			break;
		}
		case 72: {
			Get();
			m.add(Modifier.Internal);    
			break;
		}
		case 73: {
			Get();
			m.add(Modifier.Abstract);  
			break;
		}
		case 44: {
			Get();
			m.add(Modifier.Static);    
			break;
		}
		case 41: {
			Get();
			m.add(Modifier.Final);     
			break;
		}
		default: SynErr(144); break;
		}
	}

	void ClassDeclaration(Modifiers m) {
		m.check(Modifier.Classes); 
		Expect(38);
		Expect(1);
		if (la.kind == 82) {
			Get();
			Type();
		}
		if (la.kind == 83) {
			Get();
			TypeList();
		}
		ClassBody();
	}

	void InterfaceDeclaration(Modifiers m) {
		m.check(Modifier.Interfaces); 
		Expect(87);
		Expect(1);
		if (la.kind == 82) {
			Get();
			TypeList();
		}
		InterfaceBody();
	}

	void EnrichDeclaration(Modifiers m) {
		m.check(Modifier.Classes); 
		Expect(39);
		Type();
		ClassBody();
	}

	void AccessorModifier(Modifiers m) {
		if (la.kind == 69) {
			Get();
			if(!m.contains(Modifier.Public)) m.add(Modifier.Public);       
		} else if (la.kind == 70) {
			Get();
			if(!m.contains(Modifier.Protected)) m.add(Modifier.Protected); 
		} else if (la.kind == 71) {
			Get();
			if(!m.contains(Modifier.Private)) m.add(Modifier.Private);     
		} else if (la.kind == 72) {
			Get();
			if(!m.contains(Modifier.Internal)) m.add(Modifier.Internal);   
		} else SynErr(145);
	}

	void Type() {
		if (la.kind == 1) {
			Qualident();
		} else if (StartOf(12)) {
			BasicType();
		} else SynErr(146);
		BracketsOpt();
	}

	void BasicType() {
		switch (la.kind) {
		case 6: {
			Get();
			break;
		}
		case 7: {
			Get();
			break;
		}
		case 8: {
			Get();
			break;
		}
		case 9: {
			Get();
			break;
		}
		case 10: {
			Get();
			break;
		}
		case 11: {
			Get();
			break;
		}
		case 12: {
			Get();
			break;
		}
		case 13: {
			Get();
			break;
		}
		case 14: {
			Get();
			break;
		}
		case 15: {
			Get();
			break;
		}
		case 16: {
			Get();
			break;
		}
		case 17: {
			Get();
			break;
		}
		case 18: {
			Get();
			break;
		}
		case 19: {
			Get();
			break;
		}
		case 20: {
			Get();
			break;
		}
		case 21: {
			Get();
			break;
		}
		case 22: {
			Get();
			break;
		}
		case 23: {
			Get();
			break;
		}
		case 24: {
			Get();
			break;
		}
		case 25: {
			Get();
			break;
		}
		case 26: {
			Get();
			break;
		}
		case 27: {
			Get();
			break;
		}
		case 28: {
			Get();
			break;
		}
		case 29: {
			Get();
			break;
		}
		case 30: {
			Get();
			break;
		}
		case 31: {
			Get();
			break;
		}
		case 32: {
			Get();
			break;
		}
		case 33: {
			Get();
			break;
		}
		case 34: {
			Get();
			break;
		}
		case 35: {
			Get();
			break;
		}
		case 36: {
			Get();
			break;
		}
		case 37: {
			Get();
			break;
		}
		default: SynErr(147); break;
		}
	}

	void BracketsOpt() {
		while (la.kind == 56) {
			Get();
			if (la.kind == 1 || la.kind == 2 || la.kind == 3) {
				if (la.kind == 1) {
					Get();
				} else if (la.kind == 2) {
					Get();
				} else {
					Get();
				}
			}
			Expect(62);
			if (la.kind == 56) {
				BracketsOpt();
			}
		}
	}

	void TypeList() {
		Type();
		while (la.kind == 50) {
			Get();
			Type();
		}
	}

	void FormalParameter() {
		if (la.kind == 41) {
			Get();
		}
		Type();
		VariableDeclaratorId();
	}

	void VariableDeclaratorId() {
		if (la.kind == 1) {
			Get();
		} else if (la.kind == 77) {
			Get();
		} else SynErr(148);
		BracketsOpt();
	}

	void QualidentList() {
		Qualident();
		while (la.kind == 50) {
			Get();
			Qualident();
		}
	}

	void VariableDeclarator() {
		Expect(1);
		VariableDeclaratorRest();
	}

	void VariableDeclaratorRest() {
		BracketsOpt();
		if (la.kind == 53) {
			Get();
			VariableInitializer();
		}
	}

	void VariableInitializer() {
		ExprInfo dummy = new ExprInfo(this); 
		if (la.kind == 55) {
			ArrayInitializer();
		} else if (StartOf(13)) {
			Expression(dummy);
		} else SynErr(149);
	}

	void ArrayInitializer() {
		Expect(55);
		if (StartOf(14)) {
			VariableInitializer();
			while (commaAndNoRBrace()) {
				Expect(50);
				VariableInitializer();
			}
		}
		if (la.kind == 50) {
			Get();
		}
		Expect(61);
	}

	void Expression(ExprInfo info) {
		while (StartOf(15)) {
			Expression1(info);
		}
		while (StartOf(16)) {
			ExprInfo dummy = new ExprInfo(this); 
			info.setKind(ExprKind.ASSIGN);    
			AssignmentOperator();
			Expression1(dummy);
		}
	}

	void ClassBody() {
		Expect(55);
		while (StartOf(17)) {
			ClassBodyDeclaration();
		}
		Expect(61);
	}

	void ClassBodyDeclaration() {
		if (la.kind == 66) {
			Get();
		} else if (StartOf(5)) {
			Modifiers m = new Modifiers(this); 
			if (la.kind == 44) {
				Get();
				m.add(Modifier.Static);           
			}
			if (la.kind == 55) {
				Block();
			} else if (StartOf(7)) {
				if (StartOf(8)) {
					Modifier1(m);
					while (StartOf(9)) {
						Modifier0(m);
					}
				}
				MemberDecl(m);
			} else SynErr(150);
		} else SynErr(151);
	}

	void ConstructorDeclaratorRest(Modifiers m) {
		m.check(Modifier.Constructors); 
		FormalParameters();
		if (la.kind == 86) {
			Get();
			QualidentList();
		}
		Block();
	}

	void MethodOrFieldDecl(Modifiers m) {
		Type();
		if (la.kind == 1) {
			Get();
		} else if (StartOf(11)) {
			Type();
		} else if (la.kind == 77) {
			Get();
		} else SynErr(152);
		MethodOrFieldRest(m);
	}

	void VoidMethodDeclaratorRest() {
		FormalParameters();
		if (la.kind == 86) {
			Get();
			QualidentList();
		}
		if (la.kind == 55) {
			Block();
		} else if (la.kind == 66) {
			Get();
		} else SynErr(153);
	}

	void MethodOrFieldRest(Modifiers m) {
		if (StartOf(18)) {
			m.check(Modifier.Fields);  
			VariableDeclaratorsRest();
			Expect(66);
		} else if (la.kind == 57) {
			m.check(Modifier.Methods); 
			MethodDeclaratorRest();
		} else if (la.kind == 55 || la.kind == 56) {
			m.check(Modifier.Properties); 
			PropertyDeclaratorRest(m);
		} else SynErr(154);
	}

	void VariableDeclaratorsRest() {
		VariableDeclaratorRest();
		while (la.kind == 50) {
			Get();
			VariableDeclarator();
		}
	}

	void MethodDeclaratorRest() {
		FormalParameters();
		BracketsOpt();
		if (la.kind == 86) {
			Get();
			QualidentList();
		}
		if (la.kind == 55) {
			Block();
		} else if (la.kind == 66) {
			Get();
		} else SynErr(155);
	}

	void PropertyDeclaratorRest(Modifiers m) {
		BracketsOpt();
		Expect(55);
		AccessorDeclaration(m);
		Expect(61);
	}

	void AccessorDeclaration(Modifiers m) {
		if (StartOf(19)) {
			if (StartOf(20)) {
				AccessorModifier(m);
			}
			Expect(84);
			if (la.kind == 55) {
				Block();
			} else if (la.kind == 66) {
				Get();
			} else SynErr(156);
		}
		if (StartOf(21)) {
			if (StartOf(20)) {
				AccessorModifier(m);
			}
			Expect(85);
			if (la.kind == 55) {
				Block();
			} else if (la.kind == 66) {
				Get();
			} else SynErr(157);
		}
	}

	void FormalParameters() {
		Expect(57);
		if (StartOf(22)) {
			FormalParameter();
			while (la.kind == 50) {
				Get();
				FormalParameter();
			}
		}
		Expect(63);
	}

	void InterfaceBody() {
		Expect(55);
		while (StartOf(23)) {
			InterfaceBodyDeclaration();
		}
		Expect(61);
	}

	void InterfaceBodyDeclaration() {
		Modifiers m = new Modifiers(this); 
		if (la.kind == 66) {
			Get();
		} else if (StartOf(24)) {
			while (StartOf(9)) {
				Modifier0(m);
			}
			InterfaceMemberDecl(m);
		} else SynErr(158);
	}

	void InterfaceMemberDecl(Modifiers m) {
		if (StartOf(11)) {
			InterfaceMethodOrFieldDecl(m);
		} else if (la.kind == 34) {
			m.check(Modifier.Interfaces); 
			Get();
			Expect(1);
			VoidInterfaceMethodDeclaratorRest();
		} else if (la.kind == 38) {
			ClassDeclaration(m);
		} else if (la.kind == 87) {
			InterfaceDeclaration(m);
		} else SynErr(159);
	}

	void InterfaceMethodOrFieldDecl(Modifiers m) {
		Type();
		Expect(1);
		InterfaceMethodOrFieldRest(m);
	}

	void VoidInterfaceMethodDeclaratorRest() {
		FormalParameters();
		if (la.kind == 86) {
			Get();
			QualidentList();
		}
		Expect(66);
	}

	void InterfaceMethodOrFieldRest(Modifiers m) {
		if (la.kind == 53 || la.kind == 56) {
			m.check(Modifier.Constants);  
			ConstantDeclaratorsRest();
			Expect(66);
		} else if (la.kind == 57) {
			m.check(Modifier.Interfaces); 
			InterfaceMethodDeclaratorRest();
		} else SynErr(160);
	}

	void ConstantDeclaratorsRest() {
		ConstantDeclaratorRest();
		while (la.kind == 50) {
			Get();
			ConstantDeclarator();
		}
	}

	void InterfaceMethodDeclaratorRest() {
		FormalParameters();
		BracketsOpt();
		if (la.kind == 86) {
			Get();
			QualidentList();
		}
		Expect(66);
	}

	void ConstantDeclaratorRest() {
		BracketsOpt();
		Expect(53);
		VariableInitializer();
	}

	void ConstantDeclarator() {
		Expect(1);
		ConstantDeclaratorRest();
	}

	void Statement() {
		ExprInfo dummy = new ExprInfo(this); 
		if (la.kind == 55) {
			Block();
		} else if (la.kind == 88) {
			Get();
			ParExpression();
			Statement();
			if (la.kind == 89) {
				Get();
				Statement();
			}
		} else if (la.kind == 90) {
			Get();
			Expect(57);
			if (StartOf(25)) {
				ForInit();
			}
			Expect(66);
			if (StartOf(26)) {
				Expression(dummy);
			}
			Expect(66);
			if (StartOf(27)) {
				ForUpdate();
			}
			Expect(63);
			Statement();
		} else if (la.kind == 91) {
			Get();
			ParExpression();
			Statement();
		} else if (la.kind == 92) {
			Get();
			Statement();
			Expect(91);
			ParExpression();
			Expect(66);
		} else if (la.kind == 93) {
			Get();
			Block();
			if (la.kind == 100) {
				Catches();
				if (la.kind == 94) {
					Get();
					Block();
				}
			} else if (la.kind == 94) {
				Get();
				Block();
			} else SynErr(161);
		} else if (la.kind == 95) {
			Get();
			ParExpression();
			Expect(55);
			SwitchBlockStatementGroups();
			Expect(61);
		} else if (la.kind == 96) {
			Get();
			if (StartOf(26)) {
				Expression(dummy);
			}
			Expect(66);
		} else if (la.kind == 97) {
			Get();
			Expression(dummy);
			Expect(66);
		} else if (la.kind == 98) {
			Get();
			if (la.kind == 1) {
				Get();
			}
			Expect(66);
		} else if (la.kind == 99) {
			Get();
			if (la.kind == 1) {
				Get();
			}
			Expect(66);
		} else if (la.kind == 66) {
			Get();
		} else if (StartOf(26)) {
			StatementExpression();
			Expect(66);
		} else SynErr(162);
	}

	void ParExpression() {
		ExprInfo dummy = new ExprInfo(this); 
		Expect(57);
		Expression(dummy);
		Expect(63);
	}

	void ForInit() {
		if (isLocalVarDecl(true)) {
			LocalVariableDeclaration();
		} else if (StartOf(28)) {
			StatementExpression();
			MoreStatementExpressions();
		} else SynErr(163);
	}

	void ForUpdate() {
		StatementExpression();
		MoreStatementExpressions();
	}

	void Catches() {
		CatchClause();
		while (la.kind == 100) {
			CatchClause();
		}
	}

	void SwitchBlockStatementGroups() {
		while (la.kind == 101 || la.kind == 102) {
			SwitchBlockStatementGroup();
		}
	}

	void StatementExpression() {
		ExprInfo info = new ExprInfo(this); 
		Expression(info);
		info.checkExprStat();               
	}

	void BlockStatement() {
		if (isLocalVarDecl(false)) {
			LocalVariableDeclaration();
			Expect(66);
		} else if (StartOf(29)) {
			Statement();
		} else if (StartOf(2)) {
			ClassOrInterfaceDeclaration();
		} else SynErr(164);
	}

	void LocalVariableDeclaration() {
		if (la.kind == 41) {
			Get();
		}
		Type();
		VariableDeclarators();
	}

	void VariableDeclarators() {
		VariableDeclarator();
		while (la.kind == 50) {
			Get();
			VariableDeclarator();
		}
	}

	void MoreStatementExpressions() {
		while (la.kind == 50) {
			Get();
			StatementExpression();
		}
	}

	void CatchClause() {
		Expect(100);
		Expect(57);
		FormalParameter();
		Expect(63);
		Block();
	}

	void SwitchBlockStatementGroup() {
		SwitchLabel();
		while (StartOf(10)) {
			BlockStatement();
		}
	}

	void SwitchLabel() {
		if (la.kind == 101) {
			ExprInfo dummy = new ExprInfo(this); 
			Get();
			Expression(dummy);
			Expect(49);
		} else if (la.kind == 102) {
			Get();
			Expect(49);
		} else SynErr(165);
	}

	void Expression1(ExprInfo info) {
		Expression2(info);
		if (la.kind == 103) {
			info.setKind(ExprKind.CONDEXPR); 
			ConditionalExpr();
		}
	}

	void AssignmentOperator() {
		switch (la.kind) {
		case 53: {
			Get();
			break;
		}
		case 108: {
			Get();
			break;
		}
		case 109: {
			Get();
			break;
		}
		case 110: {
			Get();
			break;
		}
		case 111: {
			Get();
			break;
		}
		case 112: {
			Get();
			break;
		}
		case 113: {
			Get();
			break;
		}
		case 114: {
			Get();
			break;
		}
		case 115: {
			Get();
			break;
		}
		case 116: {
			Get();
			break;
		}
		case 117: {
			Get();
			break;
		}
		case 118: {
			Get();
			break;
		}
		default: SynErr(166); break;
		}
	}

	void Expression2(ExprInfo info) {
		Expression3(info);
		if (StartOf(30)) {
			Expression2Rest(info);
		}
	}

	void ConditionalExpr() {
		ExprInfo dummy = new ExprInfo(this); 
		Expect(103);
		Expression(dummy);
		Expect(49);
		Expression1(dummy);
	}

	void Expression3(ExprInfo info) {
		int pre = ExprKind.NONE;        
		while (prefix.Get(la.kind) || isTypeCast()) {
			if (StartOf(31)) {
				PrefixOp(info);
				if(pre == ExprKind.NONE) pre = info.getKind(); 
			} else if (la.kind == 57) {
				Get();
				Type();
				Expect(63);
				info.setKind(ExprKind.TYPECAST);
			} else SynErr(167);
		}
		Primary(info);
		while (la.kind == 52 || la.kind == 56) {
			Selector(info);
		}
		while (la.kind == 51 || la.kind == 54) {
			PostfixOp(info);
		}
		if (pre != ExprKind.NONE) info.setKind(pre); 
	}

	void Expression2Rest(ExprInfo info) {
		ExprInfo dummy = new ExprInfo(this); 
		if (StartOf(32)) {
			Infixop();
			Expression3(dummy);
			while (StartOf(32)) {
				Infixop();
				Expression3(dummy);
			}
			info.setKind(ExprKind.BINARY);       
		} else if (la.kind == 104) {
			Get();
			Type();
			info.setKind(ExprKind.TYPETEST);     
		} else SynErr(168);
	}

	void Infixop() {
		switch (la.kind) {
		case 119: {
			Get();
			break;
		}
		case 120: {
			Get();
			break;
		}
		case 121: {
			Get();
			break;
		}
		case 122: {
			Get();
			break;
		}
		case 123: {
			Get();
			break;
		}
		case 124: {
			Get();
			break;
		}
		case 125: {
			Get();
			break;
		}
		case 106: {
			Get();
			break;
		}
		case 107: {
			Get();
			break;
		}
		case 126: {
			Get();
			break;
		}
		case 127: {
			Get();
			break;
		}
		case 128: {
			Get();
			break;
		}
		case 129: {
			Get();
			break;
		}
		case 130: {
			Get();
			break;
		}
		case 60: {
			Get();
			break;
		}
		case 58: {
			Get();
			break;
		}
		case 68: {
			Get();
			break;
		}
		case 131: {
			Get();
			break;
		}
		case 132: {
			Get();
			break;
		}
		default: SynErr(169); break;
		}
	}

	void PrefixOp(ExprInfo info) {
		switch (la.kind) {
		case 54: {
			Get();
			info.setKind(ExprKind.PREINC); 
			break;
		}
		case 51: {
			Get();
			info.setKind(ExprKind.PREDEC); 
			break;
		}
		case 59: {
			Get();
			info.setKind(ExprKind.NOT);    
			break;
		}
		case 64: {
			Get();
			info.setKind(ExprKind.COMPL);  
			break;
		}
		case 60: {
			Get();
			info.setKind(ExprKind.POS);    
			break;
		}
		case 58: {
			Get();
			info.setKind(ExprKind.NEG);    
			break;
		}
		default: SynErr(170); break;
		}
	}

	void Primary(ExprInfo info) {
		if (la.kind == 57) {
			Get();
			Expression(info);
			Expect(63);
			info.setKind(ExprKind.PARENS);  
		} else if (la.kind == 47) {
			Get();
			info.setKind(ExprKind.IDENT);   
			ArgumentsOpt(info);
		} else if (la.kind == 46) {
			Get();
			SuperSuffix(info);
		} else if (StartOf(33)) {
			Literal();
			info.setKind(ExprKind.LITERAL); 
		} else if (la.kind == 42) {
			Get();
			Creator(info);
		} else if (la.kind == 105) {
			Get();
			KeyOf(info);
		} else if (la.kind == 77) {
			Get();
			info.setKind(ExprKind.IDENT);   
		} else if (la.kind == 1) {
			Get();
			while (dotAndIdent()) {
				Expect(52);
				Expect(1);
			}
			info.setKind(ExprKind.IDENT);   
			if (isIdentSuffix()) {
				IdentifierSuffix(info);
			}
		} else if (StartOf(11)) {
			if (StartOf(11)) {
				Type();
				BracketsOpt();
				Expect(1);
			} else {
				Type();
			}
			info.setKind(ExprKind.IDENT);   
		} else if (StartOf(11)) {
			if (StartOf(11)) {
				Type();
				BracketsOpt();
				Expect(52);
				Expect(1);
			} else {
				Type();
			}
			info.setKind(ExprKind.IDENT);   
		} else if (StartOf(12)) {
			BasicType();
			BracketsOpt();
			Expect(52);
			Expect(38);
			info.setKind(ExprKind.SELECT);  
		} else if (la.kind == 34) {
			Get();
			Expect(52);
			Expect(38);
			info.setKind(ExprKind.SELECT);  
		} else SynErr(171);
	}

	void Selector(ExprInfo info) {
		ExprInfo dummy = new ExprInfo(this); 
		if (la.kind == 52) {
			Get();
			if (la.kind == 1) {
				Get();
				ArgumentsOpt(info);
			} else if (la.kind == 46) {
				Get();
				Arguments();
			} else if (la.kind == 42) {
				Get();
				InnerCreator();
			} else SynErr(172);
		} else if (la.kind == 56) {
			Get();
			Expression(dummy);
			Expect(62);
		} else SynErr(173);
	}

	void PostfixOp(ExprInfo info) {
		if (la.kind == 54) {
			Get();
			info.setKind(ExprKind.POSTINC); 
		} else if (la.kind == 51) {
			Get();
			info.setKind(ExprKind.POSTDEC); 
		} else SynErr(174);
	}

	void ArgumentsOpt(ExprInfo info) {
		if (la.kind == 57) {
			info.setKind(ExprKind.APPLY);  
			Arguments();
		}
	}

	void SuperSuffix(ExprInfo info) {
		if (la.kind == 57) {
			Arguments();
			info.setKind(ExprKind.APPLY); 
		} else if (la.kind == 52) {
			Get();
			Expect(1);
			info.setKind(ExprKind.IDENT); 
			ArgumentsOpt(info);
		} else SynErr(175);
	}

	void Literal() {
		switch (la.kind) {
		case 2: {
			Get();
			break;
		}
		case 3: {
			Get();
			break;
		}
		case 4: {
			Get();
			break;
		}
		case 5: {
			Get();
			break;
		}
		case 48: {
			Get();
			break;
		}
		case 40: {
			Get();
			break;
		}
		case 43: {
			Get();
			break;
		}
		default: SynErr(176); break;
		}
	}

	void Creator(ExprInfo info) {
		if (StartOf(12)) {
			BasicType();
			ArrayCreatorRest();
			info.setKind(ExprKind.NEWARRAY); 
		} else if (la.kind == 1) {
			Qualident();
			if (la.kind == 56) {
				ArrayCreatorRest();
				info.setKind(ExprKind.NEWARRAY); 
			} else if (la.kind == 57) {
				ClassCreatorRest();
				info.setKind(ExprKind.NEWCLASS); 
			} else SynErr(177);
		} else SynErr(178);
	}

	void KeyOf(ExprInfo info) {
		Expect(106);
		Type();
		Expect(107);
		info.setKind(ExprKind.KEYOF); 
	}

	void IdentifierSuffix(ExprInfo info) {
		if (la.kind == 56) {
			Get();
			Expect(62);
			BracketsOpt();
			Expect(52);
			Expect(38);
			info.setKind(ExprKind.SELECT); 
		} else if (la.kind == 57) {
			Arguments();
			info.setKind(ExprKind.APPLY);  
		} else if (la.kind == 52) {
			Get();
			if (la.kind == 38) {
				Get();
			} else if (la.kind == 47) {
				Get();
			} else if (la.kind == 46) {
				Get();
				Expect(52);
				Expect(1);
				ArgumentsOpt(info);
			} else SynErr(179);
		} else SynErr(180);
	}

	void Arguments() {
		ExprInfo dummy = new ExprInfo(this); 
		Expect(57);
		if (StartOf(27)) {
			Expression(dummy);
			while (la.kind == 50) {
				Get();
				Expression(dummy);
			}
		}
		Expect(63);
	}

	void ArrayCreatorRest() {
		ExprInfo dummy = new ExprInfo(this); 
		Expect(56);
		if (la.kind == 62) {
			Get();
			BracketsOpt();
			ArrayInitializer();
		} else if (StartOf(34)) {
			Expression(dummy);
			Expect(62);
			while (nonEmptyBracket()) {
				Expect(56);
				Expression(dummy);
				Expect(62);
			}
			while (emptyBracket()) {
				Expect(56);
				Expect(62);
			}
		} else SynErr(181);
	}

	void ClassCreatorRest() {
		Arguments();
		if (la.kind == 55) {
			ClassBody();
		}
	}

	void InnerCreator() {
		Expect(1);
		ClassCreatorRest();
	}



	public void Parse() {
		la = new Token();
		la.val = "";		
		Get();
		Andromeda();

    Expect(0);
	}
	
	static readonly bool[,] set = {
		{T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,T, T,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,T,T, T,x,x,T, x,T,T,T, x,T,T,T, T,x,x,x, T,x,T,x, x,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,T, T,x,T,T, T,T,x,T, T,T,T,T, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,T,T, x,T,T,x, x,T,T,T, T,T,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,T,T, x,T,T,T, x,T,T,T, T,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,x,T, x,x,T,x, x,T,T,T, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x, x,T,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x, x,T,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,T,T,T, x,x,T,T, T,x,T,T, x,T,T,x, x,T,T,T, T,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,x,T, x,T,T,x, x,T,T,T, T,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,T,T, x,T,T,x, x,T,T,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,T,T, x,T,T,x, x,T,T,T, T,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,x,T, x,T,T,T, x,T,T,T, T,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,T,T, T,T,x,T, T,T,T,T, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,T, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,x, x,x,T,T, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
		{x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
		{x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,x,x, T,x,T,T, x,x,T,T, T,x,x,T, x,T,T,x, x,T,T,T, T,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}

	};
} // end Parser


internal class Errors {
	public int count = 0;                                    // number of errors detected
	public System.IO.TextWriter errorStream = Console.Out;   // error messages go to this stream
  public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
  
	public void SynErr (int line, int col, int n) {
		string s;
		switch (n) {
			case 0: s = "EOF expected"; break;
			case 1: s = "ident expected"; break;
			case 2: s = "intLit expected"; break;
			case 3: s = "floatLit expected"; break;
			case 4: s = "charLit expected"; break;
			case 5: s = "stringLit expected"; break;
			case 6: s = "abilcmd expected"; break;
			case 7: s = "actor expected"; break;
			case 8: s = "actorscope expected"; break;
			case 9: s = "aifilter expected"; break;
			case 10: s = "bank expected"; break;
			case 11: s = "bool expected"; break;
			case 12: s = "byte expected"; break;
			case 13: s = "camerainfo expected"; break;
			case 14: s = "color expected"; break;
			case 15: s = "doodad expected"; break;
			case 16: s = "fixed expected"; break;
			case 17: s = "int expected"; break;
			case 18: s = "marker expected"; break;
			case 19: s = "order expected"; break;
			case 20: s = "playergroup expected"; break;
			case 21: s = "point expected"; break;
			case 22: s = "revealer expected"; break;
			case 23: s = "sound expected"; break;
			case 24: s = "soundlink expected"; break;
			case 25: s = "string expected"; break;
			case 26: s = "text expected"; break;
			case 27: s = "timer expected"; break;
			case 28: s = "transmissionsource expected"; break;
			case 29: s = "trigger expected"; break;
			case 30: s = "unit expected"; break;
			case 31: s = "unitfilter expected"; break;
			case 32: s = "unitgroup expected"; break;
			case 33: s = "unitref expected"; break;
			case 34: s = "void expected"; break;
			case 35: s = "wave expected"; break;
			case 36: s = "waveinfo expected"; break;
			case 37: s = "wavetarget expected"; break;
			case 38: s = "class expected"; break;
			case 39: s = "enrich expected"; break;
			case 40: s = "false expected"; break;
			case 41: s = "final expected"; break;
			case 42: s = "new expected"; break;
			case 43: s = "null expected"; break;
			case 44: s = "static expected"; break;
			case 45: s = "const expected"; break;
			case 46: s = "super expected"; break;
			case 47: s = "this expected"; break;
			case 48: s = "true expected"; break;
			case 49: s = "colon expected"; break;
			case 50: s = "comma expected"; break;
			case 51: s = "dec expected"; break;
			case 52: s = "dot expected"; break;
			case 53: s = "assign expected"; break;
			case 54: s = "inc expected"; break;
			case 55: s = "lbrace expected"; break;
			case 56: s = "lbrack expected"; break;
			case 57: s = "lpar expected"; break;
			case 58: s = "minus expected"; break;
			case 59: s = "not expected"; break;
			case 60: s = "plus expected"; break;
			case 61: s = "rbrace expected"; break;
			case 62: s = "rbrack expected"; break;
			case 63: s = "rpar expected"; break;
			case 64: s = "tilde expected"; break;
			case 65: s = "\"package\" expected"; break;
			case 66: s = "\";\" expected"; break;
			case 67: s = "\"import\" expected"; break;
			case 68: s = "\"*\" expected"; break;
			case 69: s = "\"public\" expected"; break;
			case 70: s = "\"protected\" expected"; break;
			case 71: s = "\"private\" expected"; break;
			case 72: s = "\"internal\" expected"; break;
			case 73: s = "\"abstract\" expected"; break;
			case 74: s = "\"native\" expected"; break;
			case 75: s = "\"transient\" expected"; break;
			case 76: s = "\"volatile\" expected"; break;
			case 77: s = "\"value\" expected"; break;
			case 78: s = "\"typedef\" expected"; break;
			case 79: s = "\"iskey\" expected"; break;
			case 80: s = "\"is\" expected"; break;
			case 81: s = "\"uses\" expected"; break;
			case 82: s = "\"extends\" expected"; break;
			case 83: s = "\"implements\" expected"; break;
			case 84: s = "\"get\" expected"; break;
			case 85: s = "\"set\" expected"; break;
			case 86: s = "\"throws\" expected"; break;
			case 87: s = "\"interface\" expected"; break;
			case 88: s = "\"if\" expected"; break;
			case 89: s = "\"else\" expected"; break;
			case 90: s = "\"for\" expected"; break;
			case 91: s = "\"while\" expected"; break;
			case 92: s = "\"do\" expected"; break;
			case 93: s = "\"try\" expected"; break;
			case 94: s = "\"finally\" expected"; break;
			case 95: s = "\"switch\" expected"; break;
			case 96: s = "\"return\" expected"; break;
			case 97: s = "\"throw\" expected"; break;
			case 98: s = "\"break\" expected"; break;
			case 99: s = "\"continue\" expected"; break;
			case 100: s = "\"catch\" expected"; break;
			case 101: s = "\"case\" expected"; break;
			case 102: s = "\"default\" expected"; break;
			case 103: s = "\"?\" expected"; break;
			case 104: s = "\"instanceof\" expected"; break;
			case 105: s = "\"keyof\" expected"; break;
			case 106: s = "\"<\" expected"; break;
			case 107: s = "\">\" expected"; break;
			case 108: s = "\"+=\" expected"; break;
			case 109: s = "\"-=\" expected"; break;
			case 110: s = "\"*=\" expected"; break;
			case 111: s = "\"/=\" expected"; break;
			case 112: s = "\"&=\" expected"; break;
			case 113: s = "\"|=\" expected"; break;
			case 114: s = "\"^=\" expected"; break;
			case 115: s = "\"%=\" expected"; break;
			case 116: s = "\"<<=\" expected"; break;
			case 117: s = "\">>=\" expected"; break;
			case 118: s = "\">>>=\" expected"; break;
			case 119: s = "\"||\" expected"; break;
			case 120: s = "\"&&\" expected"; break;
			case 121: s = "\"|\" expected"; break;
			case 122: s = "\"^\" expected"; break;
			case 123: s = "\"&\" expected"; break;
			case 124: s = "\"==\" expected"; break;
			case 125: s = "\"!=\" expected"; break;
			case 126: s = "\"<=\" expected"; break;
			case 127: s = "\">=\" expected"; break;
			case 128: s = "\"<<\" expected"; break;
			case 129: s = "\">>\" expected"; break;
			case 130: s = "\">>>\" expected"; break;
			case 131: s = "\"/\" expected"; break;
			case 132: s = "\"%\" expected"; break;
			case 133: s = "??? expected"; break;
			case 134: s = "invalid TypeDeclaration"; break;
			case 135: s = "invalid QualifiedImport"; break;
			case 136: s = "invalid ClassOrInterfaceDeclaration"; break;
			case 137: s = "invalid ClassOrInterfaceDeclaration"; break;
			case 138: s = "invalid StaticBlockDeclaration"; break;
			case 139: s = "invalid Modifier1"; break;
			case 140: s = "invalid Modifier0"; break;
			case 141: s = "invalid MemberDecl"; break;
			case 142: s = "invalid TypedefDeclaration"; break;
			case 143: s = "invalid TypedefDeclaration"; break;
			case 144: s = "invalid ClassModifier"; break;
			case 145: s = "invalid AccessorModifier"; break;
			case 146: s = "invalid Type"; break;
			case 147: s = "invalid BasicType"; break;
			case 148: s = "invalid VariableDeclaratorId"; break;
			case 149: s = "invalid VariableInitializer"; break;
			case 150: s = "invalid ClassBodyDeclaration"; break;
			case 151: s = "invalid ClassBodyDeclaration"; break;
			case 152: s = "invalid MethodOrFieldDecl"; break;
			case 153: s = "invalid VoidMethodDeclaratorRest"; break;
			case 154: s = "invalid MethodOrFieldRest"; break;
			case 155: s = "invalid MethodDeclaratorRest"; break;
			case 156: s = "invalid AccessorDeclaration"; break;
			case 157: s = "invalid AccessorDeclaration"; break;
			case 158: s = "invalid InterfaceBodyDeclaration"; break;
			case 159: s = "invalid InterfaceMemberDecl"; break;
			case 160: s = "invalid InterfaceMethodOrFieldRest"; break;
			case 161: s = "invalid Statement"; break;
			case 162: s = "invalid Statement"; break;
			case 163: s = "invalid ForInit"; break;
			case 164: s = "invalid BlockStatement"; break;
			case 165: s = "invalid SwitchLabel"; break;
			case 166: s = "invalid AssignmentOperator"; break;
			case 167: s = "invalid Expression3"; break;
			case 168: s = "invalid Expression2Rest"; break;
			case 169: s = "invalid Infixop"; break;
			case 170: s = "invalid PrefixOp"; break;
			case 171: s = "invalid Primary"; break;
			case 172: s = "invalid Selector"; break;
			case 173: s = "invalid Selector"; break;
			case 174: s = "invalid PostfixOp"; break;
			case 175: s = "invalid SuperSuffix"; break;
			case 176: s = "invalid Literal"; break;
			case 177: s = "invalid Creator"; break;
			case 178: s = "invalid Creator"; break;
			case 179: s = "invalid IdentifierSuffix"; break;
			case 180: s = "invalid IdentifierSuffix"; break;
			case 181: s = "invalid ArrayCreatorRest"; break;

			default: s = "error " + n; break;
		}
		errorStream.WriteLine(errMsgFormat, line, col, s);
		count++;
	}

	public void SemErr (int line, int col, string s) {
		errorStream.WriteLine(errMsgFormat, line, col, s);
		count++;
	}
	
	public void SemErr (string s) {
		errorStream.WriteLine(s);
		count++;
	}
	
	public void Warning (int line, int col, string s) {
		errorStream.WriteLine(errMsgFormat, line, col, s);
	}
	
	public void Warning(string s) {
		errorStream.WriteLine(s);
	}
} // Errors


internal class FatalError: Exception {
	public FatalError(string m): base(m) {}
}

}